package comWorld.blogComment;

import webManage.UrlTools;

public class BlogComment {
	private int blogId;
	private int userId;
	private int commentId;
	private String userHome = null;
	private String portrait = null;
	private String userName = null;
	private String createTime = null;
	private String content = null;
	private int replyId = 0;
	private boolean canAdmin = false;
	private boolean canCommit = true;

	public BlogComment() {
	}
	
	public BlogComment(int blogId, int userId, int commentId, String userHome,
			String portrait, String userName, String createTime, String content, int replyId) {
		this.blogId = blogId;
		this.userId = userId;
		setUserHome(userId);
		this.commentId = commentId;
		this.userHome = userHome;
		this.portrait = portrait;
		this.userName = userName;
		this.createTime = createTime;
		this.content = content;
		this.replyId = replyId;
	}

	public int getBlogId() {
		return blogId;
	}

	public void setBlogId(int blogId) {
		this.blogId = blogId;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
		setUserHome(userId);
	}

	public int getCommentId() {
		return commentId;
	}

	public void setCommentId(int commentId) {
		this.commentId = commentId;
	}

	public String getUserHome() {
		return userHome;
	}

	public void setUserHome(int userId) {
		this.userHome = UrlTools.WEBROOTURL + "u/" + userId;
	}
	
	public String getPortrait() {
		return portrait;
	}

	public void setPortrait(String portrait) {
		if (portrait == null || portrait.length() == 0)
			this.portrait = "/images/portrait.gif";
		else 
			this.portrait = portrait;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public boolean isCanAdmin() {
		return canAdmin;
	}

	public void setCanAdmin(boolean canAdmin) {
		this.canAdmin = canAdmin;
	}

	public boolean isCanCommit() {
		return canCommit;
	}

	public void setCanCommit(boolean canCommit) {
		this.canCommit = canCommit;
	}

	public int getReplyId() {
		return replyId;
	}

	public void setReplyId(int replyId) {
		this.replyId = replyId;
	}
}
